{% extends "base.html" %}
{% block page_title %}Login{% endblock %}

{% block content %}
<div class="row">
  <div class="col-md-6 col-md-offset-3">
    <div class="card">
      <div class="cardface">
        <h2>Sign In</h2>
        <p>If you have not created an account yet, then please <a href="{{ signup_url }}">sign up</a> first.
        </p>
        {% if form.non_field_errors %}
          <div class="bg-danger alert">
            {% for err in form.non_field_errors %}
              <p class="form-error">{{ err }}</p>
            {% endfor %}
          </div>
        {% endif %}
        <form role="form" method="post" action="{% url 'account_login' %}">
          {% csrf_token %}
          <div class="form-group">
            <label class="control-label" for="{{ form.login.id_for_label }}">{{ form.login.label }}</label>
            <input class="form-control" id="{{ form.login.id_for_label }}" maxlength="30" name="{{ form.login.html_name }}" type="text" placeholder="{{ form.login.label }}" />
            {{ form.login.errors }}
          </div>
          <div class="form-group">
            <label class="control-label" for="{{ form.password.id_for_label }}">{{ form.password.label }}</label>
            <input class="form-control" id="{{ form.password.id_for_label }}" maxlength="30" name="{{ form.password.html_name }}" type="password" placeholder="{{ form.password.label }}"/>
            {{ form.password.errors }}
          </div>
          <div class="form-group">
            <div class="checkbox">
              <label>
                <input id="{{ form.remember.id_for_label }}" name="{{ form.remember.html_name }}" type="checkbox">
                {{ form.remember.label }}
              </label>
            </div>
          </div>
          <div class="form-group">
            <button class="btn btn-primary" type="submit">Sign In</button>
            <a class="button secondaryAction" href="{% url 'account_reset_password' %}">Forgot Password?</a>
            {% if redirect_field_value %}
              <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
            {% endif %}
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
{% endblock %}
